package com.zxy.salenet.web.utils;

import java.io.Serializable;

/**
 * @author: zxy
 * @version: 1.0
 * @description:    JSON格式设置
 */
   /**
 * Serializable
 */
public class Json<T> implements Serializable {
    /**
     * 响应的状态码:自定义状态码
     */
    private int code;

    /**
     * 响应的数据
     */
    private T data;

    /**
     * 用于重定向的页面地址
     */
    private String redirect;

    /**
     * 响应的提示信息
     */
    private String message;

    /**
     * 响应的错误信息
     */
    private Object error;

    /**
     * 身份校验
     */
    private String token;


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getRedirect() {
        return redirect;
    }

    public void setRedirect(String redirect) {
        this.redirect = redirect;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getError() {
        return error;
    }

    public void setError(Object error) {
        this.error = error;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public void setStatus(CodeMessage codeMessage){
        this.code = codeMessage.getCode();
        this.message = codeMessage.getMessage();
    }
}
